//package com.pp.tourism.web.service.impl;
//
//import com.pp.tourism.web.service.UserService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.security.core.authority.AuthorityUtils;
//import org.springframework.security.core.userdetails.User;
//import org.springframework.security.core.userdetails.UserDetails;
//import org.springframework.security.core.userdetails.UserDetailsService;
//import org.springframework.security.core.userdetails.UsernameNotFoundException;
//import org.springframework.security.crypto.password.PasswordEncoder;
//import org.springframework.stereotype.Component;
//
//@Component
//public class TwUserDetailsServiceImpl implements UserDetailsService {
//
//    @Autowired
//    private PasswordEncoder passwordEncoder;
//    @Autowired
//    private UserService userService;
//
//    @Override
//    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
//        com.pp.tourism.pojo.User user = userService.queryUserByUsername(username);
//        String password = passwordEncoder.encode(user.getPassword());
//        return new User(username, password, AuthorityUtils.commaSeparatedStringToAuthorityList(user.getPassword()));
//    }
//}
